﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RAD.LightOne.Test.Model
{
    [DBTable("testClass2")]
    public 
        class TestClass2 : MyObject<TestClass2>, IFull<TestClass2>
    {
        [DBField("name")]
        public string Name { get; set; }

        private TestClass1 _Owner;
        [DBField("testClass1")]
        public TestClass1 Owner
        {
            get
            {
                return _Owner;
            }
        }

        public TestClass2(TestClass1 owner):base()
        {
            this._Owner = owner;
        }

        public static IEnumerable<TestClass2> FindByOwner(TestClass1 owner)
        {
            return TestClass2.EnumerableFindBySql("select id, class_name from testclass2 where testclass1={0}", owner);
        }

        #region ISave<TestClass1> Members

        public new void Save()
        {
            base.Save();
        }

        public new void Save(System.Data.IDbTransaction trx)
        {
            base.Save(trx);
        }

        #endregion

        #region ILoad<TestClass1> Members

        public new void Load()
        {
            base.Load();
        }

        public new void Load(System.Data.IDbTransaction trx)
        {
            base.Load(trx);
        }

        #endregion

        #region IDelete<TestClass1> Members

        public new void Delete()
        {
            base.Delete();
        }

        public new void Delete(System.Data.IDbTransaction trx)
        {
            base.Delete(trx);
        }

        #endregion
    }
}
